<?php
/**
 * For a running Search Demo see: http://amazonecs.pixel-web.org
 */


error_reporting(E_ALL);
require_once('config/constant.php');
require_once(DAEMONE_HOME.'/config/amazon.php');
require_once(DAEMONE_HOME.'/lib/lib_database.php');
require_once(DAEMONE_HOME.'/lib/lib_rss_database.php');
require_once(DAEMONE_HOME.'/lib/lib_helper_function.php');

require_once(DAEMONE_HOME.'/lib/AmazonECS.class.php');
get_connection();

execute_query("drop table if exists tmp_products_count");
execute_query("create table tmp_products_count select category_id, count(1) as count from products where is_active=1 group by category_id");
execute_query("update categories set product_count=0, post_modified=now()");
execute_query("update tmp_products_count tmp, categories cat set cat.product_count=tmp.count where cat.category_id=tmp.category_id");

// execute_query("update  `categories` set  amz_grabbed_status=0 WHERE product_count < 200  ");


exit;


